﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;

namespace QuanLyNhaSach.Report
{
    public partial class frmRP_BC_TongHop : Form
    {
        public frmRP_BC_TongHop()
        {
            InitializeComponent();
        }

        private void bt_in_Click(object sender, EventArgs e)
        {
           
        }

        private void RP_BC_NhapHang_Load(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab == tab_nhaphang)
            {
                RP_BC_ChiTietNhapHang cryRpt1 = new RP_BC_ChiTietNhapHang();
                cryRpt1.Load();

                crystalReportViewer1.ReportSource = cryRpt1;
                crystalReportViewer1.Refresh();
            }
            else if (tabControl1.SelectedTab == tab_banle)
            {
                //RP_BC_ChiTietBanLe cryRpt2 = new RP_BC_ChiTietBanLe();
                //cryRpt2.Load();
                //crystalReportViewer2.ReportSource = cryRpt2;
                //crystalReportViewer2.Refresh();
            }
            else if (tabControl1.SelectedTab == tab_bansi)
            {
                //RP_BC_ChiTietBanSi cryRpt3 = new RP_BC_ChiTietBanSi();
                //cryRpt3.Load();
                //crystalReportViewer3.ReportSource = cryRpt3;
                //crystalReportViewer3.Refresh();
            }
        }

        private void radio_tonghop_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
        {
            if (radio_tonghop_nhaphang.IsChecked==true)
            {
                RP_BC_TongHDNhapHang cryRpt1 = new RP_BC_TongHDNhapHang();
                cryRpt1.Load();

                crystalReportViewer1.ReportSource = cryRpt1;
                crystalReportViewer1.Refresh();
                radDateTimePicker1.Enabled = true;
                radDateTimePicker2.Enabled = true;
            }
            else if (radio_chitiet_nhaphang.IsChecked == true)
            {
                RP_BC_ChiTietNhapHang cryRpt = new RP_BC_ChiTietNhapHang();
                cryRpt.Load();
                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
                radDateTimePicker1.Enabled = false;
                radDateTimePicker2.Enabled = false;
            }
        }
    }
}
